package demo.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import demo.common.utils.BeanHelper;
import demo.user.dto.StatusDTO;
import demo.user.mapper.StatusMapper;
import demo.user.mapper.UserStatusMapper;
import demo.user.pojo.Status;
import demo.user.pojo.UserStatus;
import demo.user.service.StatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author LonelySnow
 * @since 2020-06-15
 */
@Service
public class StatusServiceImpl extends ServiceImpl<StatusMapper, Status> implements StatusService {

    @Autowired
    private StatusMapper statusMapper;

    /**
     * 根据id获取用户角色
     * @param uid
     */
    @Override
    public StatusDTO getUserStatus(Long uid) {
        Status status= statusMapper.getOneByUserId(uid);
        StatusDTO statusDTO = BeanHelper.copyProperties(status, StatusDTO.class);
        return statusDTO;
    }
}
